namespace Gateway.Common.Extensions;

/// <summary>
/// 脱敏处理
/// </summary>
public class DesensitizeExtensions
{
    /// <summary>
    /// 手机号脱敏
    /// </summary>
    /// <param name="mobile"></param>
    /// <returns></returns>
    public static string Mobile(string mobile)
    {
        if (string.IsNullOrWhiteSpace(mobile) || (mobile.Length != 11))
        {
            return mobile;
        }
        string number = mobile.Substring(0, 3) + "****" + mobile.Substring(7, 4);
        return number;
    }
}